package com.manpower.ui;

import java.util.ArrayList;
import java.util.HashMap;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.AdapterView.OnItemClickListener;

/**
 * 入户登记 按月份 列表
 * 
 * @author kechanghe
 * 
 */
public class EnRegistrationActivity extends AnotherBaseActivity {

	private ImageView imgTitle;
	private ListView lstList;
	private final String LIST_ITEM_NAME = "name";
	private ArrayList<HashMap<String, String>> arrData = new ArrayList<HashMap<String, String>>();
	SimpleAdapter adapter;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_enregistration);
//		txtTitle.setText(R.string.label_EnRegistration);

		imgTitle = (ImageView) this.findViewById(R.id.imgTitle);
		lstList = (ListView) this.findViewById(R.id.lstList);

		adapter = new SimpleAdapter(this, arrData, R.layout.simple_list_item_1,
				new String[] { LIST_ITEM_NAME },
				new int[] { android.R.id.text1 });
		lstList.setAdapter(adapter);
		lstList.setOnItemClickListener(onItemClickLstList);
		
		loadEnRegistrationData();
	}

	private void loadEnRegistrationData() {
		for (int i = 0; i < 10; i++) {
			HashMap<String, String> hashMap = new HashMap<String, String>();
			hashMap.put(LIST_ITEM_NAME, "2012年" + (i + 1) + "月");
			arrData.add(hashMap);
		}

		adapter.notifyDataSetChanged();
	}

	private OnItemClickListener onItemClickLstList = new OnItemClickListener() {

		@Override
		public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
				long arg3) {
			startActivity(new Intent(EnRegistrationActivity.this,
					EnRegistrationItemActivity.class));
		}
	};
}
